/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017年12月14日 下午3:47:59
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */  
package com.itttq.gshop.generic.cmpt;

import java.nio.charset.Charset;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;

/**   
 * @ClassName:  JsonDateDeserializer
 * @author: 迷蝶
 * @date:   2017年12月14日 下午3:47:59 
 * @Description: TODO
 *     
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
@Configuration
public class FastJsonConverter {  
    
	protected FastJsonConverter() { }

    @Bean
    public FastJsonHttpMessageConverter fastJsonHttpMessageConverter() {
    	/** 
         * 以下是使用fastjson的一些配置转换。
         */  
        FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
//        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat );
        fastJsonConfig.setDateFormat("yyyy-MM-dd hh:mm:ss");
        fastJsonConfig.setCharset(Charset.forName("UTF-8"));
        fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
       return fastJsonHttpMessageConverter;
    }
}  